package top.usts.springframework.beans.factory.config;

import top.usts.springframework.beans.BeansException;

/**
 * @description:

 * Factory hook that allows for custom modification of new bean instances,
 * e.g. checking for marker interfaces or wrapping them with proxies.
 *
 * 用于修改新实例化 Bean 对象的扩展点
 * @author: CJ
 * @date: 2022/2/23
 */
public interface BeanPostProcessor {

    /**
     * 在 Bean 对象执行初始化方法之前，执行该方法
     * @param bean
     * @param beanName
     * @return
     * @throws BeansException
     */
    Object postProcessBeforeInitialization(Object bean,String beanName) throws BeansException;


    /**
     * 在bean执行初始化方法后，执行该方法
     * @param bean
     * @param beanName
     * @return
     * @throws BeansException
     */
    Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException;


}
